{********************************************************}
{                                                        }
{                 Zeos Database Objects                  }
{              MS SQL Transaction component              }
{                                                        }
{       Copyright (c) 1999-2001 Sergey Seroukhov         }
{    Copyright (c) 1999-2002 Zeos Development Group      }
{                                                        }
{********************************************************}

unit ZMsSqlTr;

interface

{$R *.dcr}

uses
  Classes, ZDirMsSql, ZMsSqlCon, ZTransact, ZSqlTypes;

{$INCLUDE ..\Zeos.inc}

type
  { MS SQL transaction }
  TZZMsSqlTransact = class(TZZTransact)
  private
    function  GetDatabase: TZZMsSqlDatabase;
    procedure SetDatabase(Value: TZZMsSqlDatabase);
  public
    constructor Create(AOwner: TComponent); override;

    procedure AddMonitor(Monitor: TZZMonitor); override;
    procedure DeleteMonitor(Monitor: TZZMonitor); override;
  published
    property Database: TZZMsSqlDatabase read GetDatabase write SetDatabase;
    property TransactSafe;
  end;

implementation

{***************** TZZMsSqlTransact implementation *****************}

{ Class constructor }
constructor TZZMsSqlTransact.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FHandle := TDirMsSqlTransact.Create(nil);
  FQuery  := TDirMsSqlQuery.Create(nil, TDirMsSqlTransact(FHandle));
  FDatabaseType := dtMsSql;
end;

{ Get database component }
function TZZMsSqlTransact.GetDatabase: TZZMsSqlDatabase;
begin
  Result := TZZMsSqlDatabase(FDatabase);
end;

{ Set database component }
procedure TZZMsSqlTransact.SetDatabase(Value: TZZMsSqlDatabase);
begin
  inherited SetDatabase(Value);
end;

{ Add monitor into monitor list }
procedure TZZMsSqlTransact.AddMonitor(Monitor: TZZMonitor);
begin
  ZDirMsSql.MonitorList.AddMonitor(Monitor);
end;

{ Delete monitor from monitor list }
procedure TZZMsSqlTransact.DeleteMonitor(Monitor: TZZMonitor);
begin
  ZDirMsSql.MonitorList.DeleteMonitor(Monitor);
end;

end.
